<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no" />
    <meta name="description" content="" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <!-- The above 4 meta tags *must* come first in the head; any other head content must come *after* these tags-->
    <!-- Title-->
    <title>热量评测 -健身猫</title>
    <!-- Favicon-->
    <link rel="icon" href="img/core-img/favicon.ico" />
    <!-- Core Stylesheet-->
    <link rel="stylesheet" href="/css/bmr/style.css" />
</head>
<body>
<!-- Preloader-->
<div class="preloader" id="preloader">
    <div class="spinner-grow text-secondary" role="status">
        <div class="sr-only">
            Loading...
        </div>
    </div>
</div>
<!-- Header Area-->
{{--<div class="header-area" id="headerArea">--}}
    {{--<div class="container h-100 d-flex align-items-center justify-content-between">--}}
        {{--<!-- Back Button-->--}}
        {{--<div class="back-button">--}}
            {{--<a href="profile.html"><i class="lni-arrow-left"></i>Back</a>--}}
        {{--</div>--}}
        {{--<!-- Page Title-->--}}
        {{--<div class="page-heading">--}}
            {{--<h6 class="mb-0">Edit Profile</h6>--}}
        {{--</div>--}}
        {{--<!-- Navbar Toggler-->--}}
        {{--<div class="suha-navbar-toggler d-flex justify-content-between flex-wrap" id="suhaNavbarToggler">--}}
            {{--<span></span>--}}
            {{--<span></span>--}}
            {{--<span></span>--}}
        {{--</div>--}}
    {{--</div>--}}
{{--</div>--}}
{{--<!-- Sidenav Black Overlay-->--}}
{{--<div class="sidenav-black-overlay"></div>--}}
{{--<!-- Side Nav Wrapper-->--}}
{{--<div class="suha-sidenav-wrapper" id="sidenavWrapper">--}}
    {{--<!-- Sidenav Profile-->--}}
    {{--<div class="sidenav-profile">--}}
        {{--<div class="user-profile">--}}
            {{--<img src="img/bg-img/9.jpg" alt="" />--}}
        {{--</div>--}}
        {{--<div class="user-info">--}}
            {{--<h6 class="user-name mb-0">Suha Jannat</h6>--}}
            {{--<p class="available-balance">Balance <span>$<span class="counter">478.61</span></span></p>--}}
        {{--</div>--}}
    {{--</div>--}}
    {{--<!-- Sidenav Nav-->--}}
    {{--<ul class="sidenav-nav">--}}
        {{--<li><a href="profile.html"><i class="lni-user"></i>My Profile</a></li>--}}
        {{--<li><a href="notifications.html"><i class="lni-alarm lni-tada-effect"></i>Notifications<span class="ml-3 badge badge-warning">3</span></a></li>--}}
        {{--<li><a href="pages.html"><i class="lni-empty-file"></i>All Pages</a></li>--}}
        {{--<li><a href="wishlist-grid.html"><i class="lni-heart-filled"></i>My Wishlist</a></li>--}}
        {{--<li><a href="settings.html"><i class="lni-cog"></i>Settings</a></li>--}}
        {{--<li><a href="intro.html"><i class="lni-power-switch"></i>Sign Out</a></li>--}}
    {{--</ul>--}}
    {{--<!-- Go Back Button-->--}}
    {{--<div class="go-home-btn" id="goHomeBtn">--}}
        {{--<i class="lni-arrow-left"></i>--}}
    {{--</div>--}}
{{--</div>--}}
<div class="page-content-wrapper">
    <div class="container">
        <!-- Profile Wrapper-->
        <div class="profile-wrapper-area py-3">
            <!-- User Information-->
            <div class="card user-info-card">
                <div class="card-body p-4 d-flex align-items-center">
                    <div class="user-profile mr-3">
                        <img src="/img/face_wlcat.png" alt="" />
                        {{--<div class="change-user-thumb">--}}
                            {{--<form>--}}
                                {{--<input class="form-control-file" type="file" />--}}
                                {{--<button><i class="lni-pencil"></i></button>--}}
                            {{--</form>--}}
                        {{--</div>--}}
                    </div>
                    <div class="user-info">
                        <p class="mb-0 text-white">hi: {{ $user->name ?? '健身猫'  }}</p>
                        <h5 class="mb-0">代谢热量-评测中心</h5>
                    </div>
                </div>
            </div>
            <!-- User Meta Data-->
            <div class="card user-data-card">
                <div class="card-body">
                    <form action="{{ url('calculate/update')  }}" method="post" onsubmit="return whenSubmit();" class="calculateForm">
                        @csrf
                        <div class="form-group">
                            <div class="title mb-2">
                                <i class="lni-user"></i>
                                <span>性别</span>
                            </div>
                            <select class="form-control" name="sex" id="sex">
                                <option value="1" {{ $user->sex == 1 ? 'selected' : ''  }}>男</option>
                                <option value="2" {{ $user->sex == 2 ? 'selected' : ''  }}>女</option>
                            </select>
                        </div>
                        <div class="form-group">
                            <div class="title mb-2">
                                <i class="lni-user"></i>
                                <span>年龄</span>
                            </div>
                            <input class="form-control" name="age" id="age" type="text" value="{{ $info->age ?? ''  }}" placeholder="请填写年龄"/>
                        </div>
                        <div class="form-group">
                            <div class="title mb-2">
                                <i class="lni-user"></i>
                                <span>身高/cm</span>
                            </div>
                            <input class="form-control" name="height" id="height" type="text" value="{{ $info->height ?? ''  }}" placeholder="身高"/>
                        </div>
                        <div class="form-group">
                            <div class="title mb-2">
                                <i class="lni-user"></i>
                                <span>体重 /kg</span>
                            </div>
                            <input class="form-control" name="weight" id="weight" type="text" value="{{ $info->weight ?? ''  }}" placeholder="体重"/>
                        </div>
                        <div class="form-group">
                            <div class="title mb-2">
                                <i class="lni-user"></i>
                                <span>目标：增肌/减肥</span>
                            </div>
                            <select class="form-control" name="type" id="type">
                                <option value="1" {{ $user->weight >=0  ? 'selected' : ''  }}>增肌</option>
                                <option value="2" {{ $user->weight < 0 ? 'selected' : ''  }}>减肥</option>
                            </select>
                        </div>
                        <div class="form-group">
                            <div class="title mb-2">
                                <i class="lni-user"></i>
                                <span>目标重量/kg: 譬如这个月 增肌/减肥 多少kg</span>
                            </div>
                            <input class="form-control" name="addWeight" type="text" id="addWeight" value="{{ $info->addWeight ?? ''  }}" placeholder="请填写增肌/减肥 重量kg"/>
                        </div>
                        <div class="form-group">
                            <div class="title mb-2">
                                <i class="lni-user"></i>
                                <span>目标周期</span>
                            </div>
                            <select name="cycle" class="form-control" id="cycle" placeholder="请点击选择目标周期">
                                <option value="">请点击选择目标周期</option>
                                <option value="1.15" {{ $info&&$info->cycle ==1.15  ? 'selected' : ''  }}>少运动(每周都坐着)</option>
                                <option value="1.375" {{ $info&&$info->cycle ==1.375  ? 'selected' : ''  }}>稍微运动(每周1-3次)</option>
                                <option value="1.55" {{ $info&&$info->cycle ==1.55  ? 'selected' : ''  }}>中强度运动(每周3-5次)</option>
                                <option value="1.725" {{ $info&&$info->cycle ==1.725  ? 'selected' : ''  }}>高强度运动(每周6-7次)</option>
                            </select>
                        </div>
                        <button class="btn btn-success w-100" type="submit" >@if($info)评测@else重新评测@endif</button>
                    </form>
                </div>
            </div>
        </div>
    </div>
</div>
<!-- Footer Nav-->
<div class="footer-nav-area" id="footerNav">
    <div class="suha-footer-nav h-100">
        <ul class="h-100 d-flex align-items-center justify-content-between">
            <li>
                <a href="/calculate/count">
                    <img src="img/core-img/home.svg" alt="">首页</a></li>
            <li>
                <a href="/logout">
                    <img src="img/core-img/chat.svg" alt="">退出</a></li>
            <li>
                <a href="/calculate/count">
                    <img src="img/core-img/shopping-cart.svg" alt="">评测</a></li>
            <li>
                <a href="/date/{{ isset($date) ? $date : date('Y-m-d') }}">
                    <img src="img/core-img/heart.svg" alt="">营养表</a></li>
            <li>
                <a href="/food/{{ isset($date) ? $date : date('Y-m-d') }}">
                    <img src="img/core-img/settings.svg" alt="">+食物</a></li>
        </ul>
    </div>
</div>
<!-- All JavaScript Files-->
<script src="/js/jquery.min.js"></script>
<script src="/js/popper.min.js"></script>
<script src="/js/bootstrap4.4.min.js"></script>
<script src="/js/waypoint1.6.min.js"></script>
<script src="/js/jquery.easing.min.js"></script>
<script src="/js/owl.carousel.min.js"></script>
<script src="/js/imagesloaded.pkgd.min.js"></script>
<script src="/js/isotope.pkgd.min.js"></script>
<script src="/js/jquery.magnific-popup.min.js"></script>
<script src="/js/jquery.animatedheadline.min.js"></script>
<script src="/js/jquery.counterup.min.js"></script>
<script src="/js/wow.min.js"></script>
<script src="/js/jarallax.min.js"></script>
<script src="/js/jarallax-video.min.js"></script>
<script src="/js/jquery.passwordstrength.js"></script>
<script src="/js/bmr/active.js"></script>
</body>
</html>
<script>
    function whenSubmit() {
        //input不能为空
        $inputs = $('.calculateForm').serializeArray();
        for (let key in $inputs) {
            var value = $inputs[key]['value'];
            if ($inputs[key]['name'] == '_token') {
                continue;
            }
            if (value == '') {
                alert($('#'+$inputs[key]['name']).attr('placeholder'))
                return false;
            }
            if (parseFloat(value) != value) {
                alert($('#'+$inputs[key]['name']).attr('placeholder') + ' 是一个数字')
                return false;
            }
        }
        var
                type = {"1": '增肌', "2": '減肥'},
                cycle = {"0": "请点击选择目标周期", "1.15": "少运动(每周都坐着)", "1.375": "稍微运动(每周1-3次)", "1.55": "中强度运动(每周3-5次)", "1.725": "高强度运动(每周6-7次)"},
                ageInput = $('#age').val(),
                typeInput = $('#type').val(),
                addWeight = $('#addWeight').val(),
                cycleInput = $('#cycle').val()
                ;

        typeInput = type[typeInput];
        cycleInput = cycle[cycleInput];

        if (confirm(
                        "瞄~ " +
                        "这个月我的运动周期是： " + cycleInput +
                        "; 这个月我的目标是：" + typeInput + addWeight + 'kg'
                )) {
            return true;
        }
        return false;
    }
</script>